// @ts-ignore
/* eslint-disable */
import { request } from 'umi';

/** 获取全部角色 GET /api/role/all */
export async function getApiRoleAll(options?: { [key: string]: any }) {
  return request<API.SimpleResultListRoleDto>('/api/role/all', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 获取权限配置详情 GET /api/role/configre/${param0} */
export async function getApiRoleConfigreById(
  params: {
    // path
    id: number;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.SimpleResultRoleConfigureDetailDto>(`/api/role/configre/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 更新权限配置 PUT /api/role/${param0}/configre */
export async function putApiRoleByIdConfigre(
  params: {
    // path
    id: number;
  },
  body: string[],
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/role/${param0}/configre`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 获取角色授权用户 GET /api/role/${param0}/users */
export async function getApiRoleByIdUsers(
  params: {
    // path
    id: number;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.SimpleResultListUserDto>(`/api/role/${param0}/users`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 更新角色的授权人员 PUT /api/role/${param0}/users */
export async function putApiRoleByIdUsers(
  params: {
    // path
    id: number;
  },
  body: number[],
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/role/${param0}/users`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 插入一条数据 POST /api/role */
export async function postApiRole(
  body: API.RoleCreateAndUpdateDto,
  options?: { [key: string]: any },
) {
  return request<any>('/api/role', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除一个或多个 DELETE /api/role */
export async function deleteApiRole(body: number[], options?: { [key: string]: any }) {
  return request<any>('/api/role', {
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 更新数据 PUT /api/role/${param0} */
export async function putApiRoleById(
  params: {
    // path
    id: number;
  },
  body: API.RoleCreateAndUpdateDto,
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<any>(`/api/role/${param0}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 分页查询 POST /api/role/${param0}/${param1}/paged-list */
export async function postApiRoleByIndexByLimitPagedList(
  params: {
    // query
    /** 关键字查询 */
    Keyword?: string;
    /** 开始时间 */
    StartTime?: string;
    /** 结束时间 */
    EndTime?: string;
    // path
    /** 当前页码 */
    index: number;
    /** 每页数量 */
    limit: number;
  },
  body: API.RoleSort,
  options?: { [key: string]: any },
) {
  const { index: param0, limit: param1, ...queryParams } = params;
  return request<API.SimpleResultPagingListRoleDto>(`/api/role/${param0}/${param1}/paged-list`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json-patch+json',
    },
    params: {
      ...queryParams,
    },
    data: body,
    ...(options || {}),
  });
}

/** 查询明细数据 GET /api/role/detail/${param0} */
export async function getApiRoleDetailById(
  params: {
    // path
    id: number;
  },
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.SimpleResultRoleDetailDto>(`/api/role/detail/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}
